<?php
	if(isset($_REQUEST['control'])){
		include("user_verify.php");
	}
?>

<table class="bordered" >
    <thead>
    <tr>
        <th>
        	User Management...!<div class="new_sale"><a href="index.php?page=user_list&action=user_new">New User</a></div>
        </th>
    </tr>
    </thead>
    <tr>
    	<?php 
			if(@$errors!=""){
				echo " <td colspan=\"3\"><span class='red'>". @$errors."</span></td>";
			}else{
				if(isset($_REQUEST['msgStatus']))
					echo " <td colspan=\"3\"><span class='red'>". $_REQUEST['msgStatus']."</span></td>";
			 }
			?>
    </tr>
</table>	
<div id="dt_example">
    <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
        <thead>
            <tr>
                <th>Photo</th>
                <th>Full Name</th>
                <th>User Log</th>
                <th>Type</th>
                <th>Email</th>
                <th>Active</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            <?php
            $sql = "SELECT * FROM tbl_user ORDER BY user_id DESC ";
            $result = mysql_query($sql);
            while ( $row = mysql_fetch_object($result)){
            ?>
            <tr >
            	<td><img src="users/<?php $photo=$row->photo; echo $photo;  ?>" width="80" height="100"  /></td>
                <td><?php echo $row->full_name; ?></td>
                <td><?php echo $row->user_name; ?></td>
                <td><?php echo $row->type; ?></td>
                <td><?php echo $row->email; ?></td>
                <td>
                    <?php 
                      $icon_publish = $row->active==0 ? "publish_x.png" : "publish_y.png";
                      $publish_image = "<img width='15px' src='images/{$icon_publish}' />";														
                    ?>
                      <a href="index.php?page=user_list&action=user_list&control=publish&active=<?php echo $row->active. "&user_id=" . $row->user_id;?>">
                    <?php echo $publish_image; ?></a>
                </td>
                <td>
                	<a href="index.php?page=user_list&action=user_new&user_id=<?php echo $row->user_id	; ?>"><img src="images/edit.png" border="0" alt="Edit"></a> | <a href="index.php?page=user_list&action=user_list&control=delete&user_id=<?php echo $row->user_id; ?>&photo=<?php echo $photo;?>" onclick="return confirm('Are you sure want to delete?');"><img src="images/delete.png" border="0" alt="delete"></a>
                </td>
    
            </tr>
            <?php 
            }
            ?>
            
        </tbody>
    </table>
</div>
